﻿@using Yyyg.Models;
@using Yyyg.BLL;
@model Member
@{
    ViewBag.Title = "UserInfo";
    Layout = "~/Views/UserInfo/_LayoutUserPanel.cshtml";
    string enmob = Tools.MobEncrypt(Model.Mobile);
    string headUrl = ViewBag.HeadUrl;
    UserCollect[] favorites = ViewBag.Favorites;
    var regdays = (int)(DateTime.Now - Model.Createtime).TotalDays;
    var bycount = Model.Orders.Sum(s => s.Bycount);
    var wins = Model.Rushby_over.Count();
}
@section head{
    <link href="~/Content/userpanel-userinfo.css?@Tools.GetRandMax()" rel="stylesheet" />
    <script src="~/Scripts/src/userpanel-userinfo.js?version=2105091511"></script>
}
<div class="uif">
    <div class="titbar iconfont icon-user">用户信息</div>
    <div class="panel">
        <div class="panel-lef">
            <div class="userblk">
                <div class="idbx">
                    ID:@Model.Uid
                </div>
                <div class="imgbx">
                    <img class="headimg" title="点击查看头像" src="@headUrl" />
                </div>
                <div class="unamebx">
                    <span class="uname">@Model.Petname</span>
                    <span class="sex layui-icon @(Model.Sex=="男"?"layui-icon-male":"layui-icon-female") "></span>
                </div>
                <div class="urem">
                    <span class="myrem iconfont icon-jinbi">@Model.Acbal</span>
                    <span class="pay">(<a id="paynow" class="iconfont icon-chongzhi" href="javascript:void(0)" onclick="Tools.showTopUp();">充值</a>)</span>
                </div>
            </div>
            <div class="editbx">
                <button id="editdata" class="layui-btn layui-btn-xs layui-btn-normal iconfont icon-jilu">编辑资料</button>
                <button id="alterpwd" class="layui-btn layui-btn-xs layui-btn-normal iconfont icon-xiugaimima">修改密码</button>
            </div>
            <ul class="tab-title">
                <li class="this iconfont">&#xe603 夺宝生涯</li>
                <li class="iconfont">&#xe602 我的收藏</li>
            </ul>
        </div>
        <div class="panel-rig">
            <div class="tab-content">
                <div class="tab-page  show">
                    <div class="other">
                        <div class="cenbox">
                            <div class="item">
                                <div class="flg">
                                    <div class="title">
                                        <span>累计夺宝</span>
                                    </div>
                                    <div class="content">
                                        <span>@(bycount)人次</span>
                                    </div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="flg">
                                    <div class="title">
                                        <span>累计中奖</span>
                                    </div>
                                    <div class="content">
                                        <span>@(wins)次</span>
                                    </div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="flg">
                                    <div class="title">
                                        <span>累计晒单</span>
                                    </div>
                                    <div class="content">
                                        <span>0回</span>
                                    </div>
                                </div>
                            </div>
                            <div class="item">
                                <div class="flg">
                                    <div class="title">
                                        <span>注册时间</span>
                                    </div>
                                    <div class="content">
                                        <span>@(regdays)天</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div style="padding:10px;" class="tab-page page-fav">
                    <div class="favlist">
                    </div>
                    <div class="laypage">
                        <div id="collect-page"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@* 用户信息修改弹出层 *@
<div id="editbx" style="display:none">
    <form id="formuser" class="layui-form" action="/UserInfo/ChangeInfo" method="post" enctype="multipart/form-data">
        <div class="layui-form-item head-item">
            <label class="headbox iconfont icon-gdtype-3" for="headimgul" title="点击修改头像">
                <img class="headimg" id="headimgshow" src="@headUrl" />
                <input type="file" style="display:none" id="headimgul" accept="image/jpeg,image/png" name="HeadImg" />
            </label>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label iconfont icon-user">用户昵称:</label>
            <div class="layui-input-block">
                <input id="user-name" class="layui-input" lay-verify="required" placeholder="请输入昵称(长度10)" maxlength="10" type="text" name="PetName" value="@Model.Petname" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label  iconfont icon-mobile-phone">手机号码:</label>
            <div class="layui-input-block">
                <div class="layui-inline">
                    <input id="user-mob" autocomplete="off" class="layui-input" type="text" readonly="readonly" value="@enmob" />
                </div>
                <div class="layui-inline">
                    <button type="button" id="btn-change-mob" class="layui-btn layui-btn-warm layui-btn-xs">修改</button>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label iconfont icon-email">我的邮箱:</label>
            <div class="layui-inline">
                <input id="user-email" autocomplete="off" class="layui-input" type="text" value="@Model.Email" readonly="readonly" placeholder="暂未绑定邮箱" />
            </div>
            <div class="layui-inline">
                <button type="button" id="btn-change-email" class="layui-btn layui-btn-warm layui-btn-xs">修改绑定</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label iconfont icon-xingbie">个人性别:</label>
            <div class="layui-inline">
                <input type="radio" name="Sex" title="男" value="男" @(Model.Sex == "男" ? "checked" : "") />
                <input type="radio" name="Sex" title="女" value="女" @(Model.Sex == "女" ? "checked" : "") />
            </div>
        </div>
        <div class="layui-form-item savebtnbx">
            <button class="layui-btn layui-btn-warm" lay-submit id="edit-save">保存</button>
        </div>
    </form>
</div>

@* 修改密码弹出层 *@
<div id="alterpwdbx" style="display:none">
    <div class="title">
        修改登陆密码
    </div>
    <form id="form-alterpwd" class="layui-form" action="/userinfo/changepwd" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">原密码:</label>
            <div class="layui-input-inline">
                <input class="layui-input" autocomplete="off" required lay-verify="required" type="password" name="oldpwd" placeholder="请输入原密码" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">新密码:</label>
            <div class="layui-input-inline">
                <input class="layui-input" autocomplete="off" required lay-verify="required|password|unequalToOldPwd" type="password" name="newpwd" placeholder="请输入新密码" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认新密码:</label>
            <div class="layui-input-inline">
                <input class="layui-input" autocomplete="off" required lay-verify="required|confirmPwd" type="password" name="confirmpwd" placeholder="确认新密码" />
            </div>
        </div>
        <div class="layui-form-item submit-item">
            <button class="layui-btn layui-btn-warm submit" lay-submit>确认修改</button>
        </div>
    </form>
</div>

@* 手机号修改弹出层 *@
<div style="display:none" class="stepdev" id="mob-changebx">
    <div class="long">
        <div class="bz1">
            <div class="title">
                请输入新的手机号:
            </div>
            <div class="content">
                <div class="input-block">
                    <label>新号码:</label>
                    <div>
                        <input type="text" id="newmob" placeholder="请输入11位手机号" maxlength="11" value="" />
                    </div>
                </div>
            </div>
            <div class="opers">
                <button class="layui-btn layui-btn-warm layui-btn-sm step-next-mob">下一步</button>
            </div>
        </div>
        <div class="bz2">
            <div class="title">我们已向@(enmob)发送了验证短信,<br />请输入短信验证码</div>
            <div class="content">
                <div class="input-block">
                    <label>验证码:</label>
                    <div>
                        <input placeholder="请输入6位短信验证码" maxlength="6" type="text" value="" />
                    </div>
                </div>
            </div>
            <div class="opers">
                <button class="layui-btn layui-btn-warm layui-btn-sm step-ok step-ok-mob">确认修改</button>
            </div>
        </div>
    </div>
</div>

@* 邮箱修改弹出层 *@
<div style="display:none" class="stepdev" id="email-changebx">
    <div class="long">
        <div class="bz1">
            <div class="title">请输入新的邮箱:</div>
            <div class="content">
                <div class="input-block">
                    <label>新邮箱:</label>
                    <div>
                        <input type="text" id="newemail" placeholder="请输入邮箱地址" value="" />
                    </div>
                </div>
            </div>
            <div class="opers">
                @if (string.IsNullOrEmpty(Model.Email))
                {
                    <button class="layui-btn layui-btn-warm layui-btn-sm btn-email-ok">确认绑定</button>
                }
                else
                {
                    <button class="layui-btn layui-btn-warm layui-btn-sm step-next-email">下一步</button>
                }
            </div>
        </div>
        <div class="bz2">
            <div class="title">我们已向@(Model.Email)发送了验证邮件,<br />请输入邮件验证码</div>
            <div class="content">
                <div class="input-block">
                    <label>验证码:</label>
                    <div>
                        <input placeholder="请输入6位验证码" maxlength="6" type="text" value="" />
                    </div>
                </div>
            </div>
            <div class="opers">
                <button class="layui-btn layui-btn-warm layui-btn-sm step-ok step-ok-email">确认修改</button>
            </div>
        </div>
    </div>
</div>